// 区域Api
import request from '@/utils/request'

enum Api {
  buildingList = '/space/getUserHomes',
  buildingUpdate = '/space/saveHome',
  buildingAdd = '/space/addHome',
  buildingDelete = '/space/delHome',
  spaceList = '/space/getSpaces',
  spaceUpdate = '/space/saveSpace',
  spaceAdd = '/space/space/add',
  spaceDelete = '/space/delSpace',
  spaceAddDevice = '/space/addDevice',
  spaceRemoveDevice = '/space/removeDevice',
  getSpaceDevices = '/space/getSpaceDevices',
  spaceSaveDevice = '/space/saveDevice',
}

// 获取区域列表
export const getBuildingList = (data) => {
  return request({
    url: Api.buildingList,
    method: 'post',
    data,
  })
}
// 区域保存
export const buildingUpdate = (data) => {
  return request({
    url: Api.buildingUpdate,
    method: 'post',
    data,
  })
}
// 区域新增
export const buildingAdd = (data) => {
  return request({
    url: Api.buildingAdd,
    method: 'post',
    data,
  })
}
// 区域删除
export const buildingDelete = (data) => {
  return request({
    url: Api.buildingDelete,
    method: 'post',
    data,
  })
}

// 获取空间列表
export const getSpaceList = (data) => {
  return request({
    url: Api.spaceList,
    method: 'post',
    data,
  })
}
// 空间保存
export const spaceUpdate = (data) => {
  return request({
    url: Api.spaceUpdate,
    method: 'post',
    data,
  })
}
// 空间新增
export const spaceAdd = (data) => {
  return request({
    url: Api.spaceAdd,
    method: 'post',
    data,
  })
}
// 空间删除
export const spaceDelete = (data) => {
  return request({
    url: Api.spaceDelete,
    method: 'post',
    data,
  })
}

// 添加设备
export const spaceAddDevice = (data) => {
  return request({
    url: Api.spaceAddDevice,
    method: 'post',
    data,
  })  
}
// 删除设备
export const spaceRemoveDevice = (data) => {
  return request({
    url: Api.spaceRemoveDevice,
    method: 'post',
    data,
  })
}
// 获取设备
export const getSpaceDevices = (data) => {
  return request({
    url: Api.getSpaceDevices,
    method: 'post',
    data,
  })
}
// 保存设备
export const spaceSaveDevice = (data) => {
  return request({
    url: Api.spaceSaveDevice,
    method: 'post',
    data,
  })
}
